package cnsatmsmart.automation.mmi.controller.Buffer;

import cnsatmsmart.automation.mmi.controller.IO.Painter;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author SIK - PTIK, BPPT
 */
public class FlightPlanThread implements Runnable{

    /* atribut - atribut yang dimiliki oleh kelas FlightPlanThread */
        private FlightPlanList flightPlanList;          //list dari FlightPlan
        private boolean ExitThread = false;             //untuk memberhentikan thread

    /**
     * membuat objek flightplanthread untuk mengupdate tampilan
     * @param flightPlanList list dari flightplan
     */
        public FlightPlanThread(FlightPlanList flightPlanList)
            {this.flightPlanList = flightPlanList;}

    /* method - method yang diperlukan untuk thread */
        public synchronized void Exit()
        {
            this.notify();
            this.ExitThread = true;
        }

        public synchronized void run() {
            while (!ExitThread)
            {
                this.flightPlanList.updateFlightPlan();
          
                try {
                    this.wait(60000);      //Thread sleep 0.5 detik
                } catch (InterruptedException ex) {
                    Logger.getLogger(Painter.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
}
